using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Xml;
using System.Collections;

namespace TVDesigner.Entities.Elements
{
    [XmlRoot("GenericComponent")]
    public abstract class GenericComponent
    {
        protected string _Name;
        protected Point _Location;
        protected Size _Size;
        private bool _Visible;

        [NonSerialized]
        private Screen _Parent;        

        #region Public Properties
        
        [Browsable(false)]
        [XmlIgnoreAttribute()]
        public Screen ParentScreen
        {
            get { return _Parent; }
            set { _Parent = value; }
        }

        [XmlAttributeAttribute("Name")]
        [Category("Design")]
        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }
        [XmlElementAttribute("Size")]
        [Category("Layout")]
        public Size Size
        {
            get { return _Size; }
            set { _Size = value; }
        }
        [XmlElementAttribute("Location")]
        [Category("Layout")]
        public Point Location
        {
            get { return _Location; }
            set { _Location = value; }
        }
        [XmlAttributeAttribute("Visible")]
        [Category("Layout")]
        public bool Visible
        {
            get { return _Visible; }
            set { _Visible = value; }
        }
        #endregion

        public GenericComponent()
        {
            _Visible = true;
        }

        #region Public Properties used to generate Java code.



        [Browsable(false)]
        [XmlIgnoreAttribute()]
        public string NameStartedWithUpperCase
        {
            get
            {
                char c = _Name.ToUpper()[0];
                return
                    string.Concat(c, _Name.Substring(1, _Name.Length - 1));
            }
        }

        [Browsable(false)]
        [XmlIgnoreAttribute()]
        public string NameStartedWithLowerCase
        {
            get
            {
                char c = _Name.ToLower()[0];
                return
                    string.Concat(c, _Name.Substring(1, _Name.Length - 1));
            }
        }        
        #endregion


        //#region override
        //public override bool Equals(object obj)
        //{
        //    if (obj != null && obj.GetType() == this.GetType())
        //    {
        //        return (((GenericComponent)obj).Name.Equals(this.Name));
        //    }
        //    return false;
        //}

        //#endregion
    }
}
